<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>DUXCMS内容管理系统</title>
<meta name="keywords" content=""/>
<meta name="description" content=""/>
<meta name="viewport" content="width=device-width"/>
<link href="__PUBLIC__/css/base.css" rel="stylesheet" type="text/css"/>
<link href="__PUBLIC__/css/skin.css" rel="stylesheet" type="text/css"/>
<link href="__PUBLIC__/css/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- 头部 -->
<div class="g-hd s-hd">
	<div class="m-logo s-logo"><img src="__PUBLIC__/images/ui-top-logo.gif" width="200" height="50"></div>
	<ul class="m-nav s-nav" id="nav">
		<li><a href="javascript:;" data="{$url(menu/index)}" class="selected">首页</a></li>
		<li><a href="javascript:;" data="{$url(menu/category)}">栏目</a></li>
		<li><a href="javascript:;" data="{$url(menu/content)}">内容</a></li>
		<li><a href="javascript:;" data="{$url(menu/expand)}">功能</a></li>
		<li><a href="javascript:;" data="{$url(menu/admin)}">管理</a></li>
        <?php ApiHook('hook_menu_top_ext'); ?>
	</ul>
	<div class="m-logout s-logout f-csp"> <a href="javascript:;" class="icon" id="logout">&#xf011;</a></div>
	<div class="m-clear s-clear f-csp" id="clear"> <span class="icon">&#xf0e2;</span></div>
	<div class="m-user-info s-user-info f-csp" id="user-info"> {$userInfo.nicename} <span class="icon">&#xf0d7;</span> </div>
	<div class="m-flags s-flags f-csp" id="site"> {$site_info.SITE_NAME} <span class="icon">&#xf0d7;</span> </div>
	
</div>
<!-- /头部 --> 
<!-- 侧栏 -->
<div class="g-sd s-sd"  id="menu" >
	
</div>
<!-- /侧栏 --> 
<!-- 中部 -->
<div class="g-mn">
	<iframe src="" id="page" width="100%" height="100%" frameborder="0"></iframe>
</div>
<!-- /中部 -->
</body>
<script>
var basedir='__PUBLIC__/ui/';
</script>
<script src="__PUBLIC__/ui/do.js"></script>
<script src="__PUBLIC__/ui/config.js"></script>
<script>
var open_one = new function(){};
var navhref= new function(){};
var clear= new function(){};
var site= new function(){};
Do.ready('icofont','flags','tip','dialog',function() {
	//处理样式
	$('#page').height($(window).height()-50);
	window.onresize = function () {
		$('#page').height($(window).height()-50);
	}
	//打开第一个页面
	window.open_one =function open_one() {
		url=$("#menu ul :first a").attr("data");
		if(url!==null||url!==''){
			$('#page').attr('src',url);
		}
		
	}
	//打开主菜单	
	function menu(url) {
		$.get(url, function(result){
			$('#menu').html(result);
		});
	}
	
	
	//绑定导航
	$(document).on("click","#nav a",function(){
		if($(this).attr('data')==''){
			return;
		}
		$('#nav a').removeClass('selected');
		$(this).addClass('selected');
		menu($(this).attr('data'));
	});
	
	$(document).on("click","#menu ul a",function(){
		$('#menu ul a').removeClass('selected');
		$(this).addClass('selected');
		$('#page').attr('src',$(this).attr('data'));
	});
	
	//加载主菜单
	menu('{$url(menu/index)}');
	
	$("#user-info").powerFloat({
		reverseSharp:true,
		width: 150,
		target: [
			{
				href: "javascript:navhref('__ROOT__/');",
				text: "网站首页"	
			},
			{
				href: "javascript:addtab('修改帐号资料','<?php echo url('admin_user/user_list/edit',array('uid'=>$userInfo['uid'])); ?>');",
				text: "修改资料"	
			}
		],
		targetMode: "list"	
	});
	
	window.navhref = function navhref(url) {
		window.open(url); 
	}
	
	
	$("#site").powerFloat({
		reverseSharp:true,
		width: 120,
		target: [
			<!--foreach:{$site_list $vo}-->
			{
				href: "javascript:site('{$vo['SITE_DOMAIN']}')",
				text: "{$vo['SITE_NAME']}"	
			},
			<!--{/foreach}-->
			{
				href: "",
				text: ""	
			}
		],
		targetMode: "list"	
	});
	window.site = function site(url) {
		if(url==''||url==null){
			art.dialog({
				content: '您没有设置此站点的绑定域名，请先设置！',
				ok: function () {
					$('#page').attr('src','{$url(site_manage/admin_list/index)}');
				},
				cancelVal: '关闭',
				cancel: true //为true等价于function(){}
			});
		}else{
			url=url.split(",");
			window.location.href='http://'+url[0]+'/index.php?r=admin'; 
		}
		
	}
	
	$("#clear").powerFloat({
		reverseSharp:true,
		width: 120,
		target: [
			{
				href: "javascript:clear('1')",
				text: "清除所有缓存"	
			},
			{
				href: "javascript:clear('2')",
				text: "清除模板缓存"	
			},
			{
				href: "javascript:clear('3')",
				text: "清除静态缓存"	
			},
			{
				href: "javascript:clear('4')",
				text: "清除数据缓存"	
			},
			{
				href: "javascript:clear('5')",
				text: "清除APP缓存"	
			}
		],
		targetMode: "list"	
	});
	
	window.clear = function clear(type){
		var url;
		switch (type) {
			case '1':
				url="{$url(cache/clear_all)}";
				break;
			case '2':
				url="{$url(cache/clear_tpl)}";
				break;
			case '3':
				url="{$url(cache/clear_html)}";
				break;
			case '4':
				url="{$url(cache/clear_data)}";
				break;
			case '5':
				url="{$url(cache/clear_app)}";
				break;
		}
			
		
		$.get(url, function(json){
			art.dialog.tips(json.info);
			$.powerFloat.hide();
		},'json');
	}
	
	//绑定退出
	$('#logout').click(function() {
        art.dialog({
			content: '确认要退出DUXCMS网站管理系统吗？',
			ok: function () {
				window.location.href="{$url(login/login/logout)}"; 
			},
			cancelVal: '关闭',
			cancel: true //为true等价于function(){}
		});
    });
	 
        
});
</script>
</html>
